package asu.logging
{
	import flash.utils.getQualifiedClassName;
	
	import asu.logging.targets.TraceTarget;
	
	public class LogUtil 
	{
		public static function getLogger( caller:Object ):ILogger
		{
			return Log.getLogger( getFullClassName( getQualifiedClassName( caller ) ) );
		}
		
		public static function getFullClassName(qualifiedClassName : String):String
		{
			return qualifiedClassName.indexOf("::") > -1 ? qualifiedClassName.split("::").join(".") : qualifiedClassName;
		}
		
		public static function getTraceTarget():TraceTarget
		{
			var basicTarget:TraceTarget = new TraceTarget();
			// Filters
			//basicTarget.filters = ['controller.*','view.*'];
			basicTarget.level = LogEventLevel.ALL;
			basicTarget.fieldSeparator =" - ";
			basicTarget.includeDate = false;
			basicTarget.includeTime = false;
			basicTarget.includeCategory = true;
			basicTarget.includeLevel = true; 
			return basicTarget;
		}
		
		public static function addTarget( target:ILoggingTarget ):void
		{
			Log.addTarget( target );
		}
	}
}